package main

import (
	"fmt"
	helloworld "grpc/heelo/proto"
)
import "github.com/golang/protobuf/proto"

type Hello struct {
	Name   string   `json:"name,omitempty"`
	Age    int      `json:"age,omitempty"`
	Course []string `json:"course,omitempty"`
}

func main() {
	req := helloworld.HelloRequest{Name: "为", Age: 50, Course: []string{
		"测试", "wadaw",
	}}
	marshal, _ := proto.Marshal(&req)

	he := helloworld.HelloRequest{}

	fmt.Println(marshal)
	_ = proto.Unmarshal(marshal, &he)
	fmt.Println(he.Name, he.Age, he.Course)

	//h := Hello{
	//	Name: "为",
	//	Age:  50,
	//	Course: []string{
	//		"测试", "wadaw",
	//	},
	//}
	//bytes, _ := json.Marshal(h)
	//fmt.Println(len(bytes))
}
